"""Scaling rules that adjust operation parameters based on preview/export size differences."""

from __future__ import annotations

from typing import Dict

PARAM_SCALE_INT = "length"
PARAM_SCALE_FLOAT = "float"
PARAM_SCALE_AREA = "area"

PARAM_SCALE_RULES: Dict[str, Dict[str, str]] = {
    "gaussian_blur": {"kernel": PARAM_SCALE_INT, "sigma": PARAM_SCALE_FLOAT},
    "median_blur": {"kernel": PARAM_SCALE_INT},
    "illumination": {"kernel": PARAM_SCALE_INT, "sigma": PARAM_SCALE_FLOAT},
    "spatial_lowpass": {"kernel": PARAM_SCALE_INT},
    "spatial_highpass": {"kernel": PARAM_SCALE_INT},
    "bilateral": {"diameter": PARAM_SCALE_INT, "sigma_space": PARAM_SCALE_FLOAT},
    "sobel": {"kernel": PARAM_SCALE_INT},
    "log": {"kernel": PARAM_SCALE_INT, "sigma": PARAM_SCALE_FLOAT},
    "dog": {"sigma1": PARAM_SCALE_FLOAT, "sigma2": PARAM_SCALE_FLOAT},
    "morph_erode": {
        "kernel": PARAM_SCALE_INT,
        "kernel_width": PARAM_SCALE_INT,
        "kernel_height": PARAM_SCALE_INT,
    },
    "morph_dilate": {
        "kernel": PARAM_SCALE_INT,
        "kernel_width": PARAM_SCALE_INT,
        "kernel_height": PARAM_SCALE_INT,
    },
    "morph_open": {
        "kernel": PARAM_SCALE_INT,
        "kernel_width": PARAM_SCALE_INT,
        "kernel_height": PARAM_SCALE_INT,
    },
    "morph_close": {
        "kernel": PARAM_SCALE_INT,
        "kernel_width": PARAM_SCALE_INT,
        "kernel_height": PARAM_SCALE_INT,
    },
    "minimum_filter": {
        "kernel": PARAM_SCALE_INT,
        "kernel_width": PARAM_SCALE_INT,
        "kernel_height": PARAM_SCALE_INT,
    },
    "maximum_filter": {
        "kernel": PARAM_SCALE_INT,
        "kernel_width": PARAM_SCALE_INT,
        "kernel_height": PARAM_SCALE_INT,
    },
    "gabor": {
        "kernel": PARAM_SCALE_INT,
        "sigma": PARAM_SCALE_FLOAT,
        "wavelength": PARAM_SCALE_FLOAT,
    },
    "hough": {"min_length": PARAM_SCALE_INT, "max_gap": PARAM_SCALE_INT},
    "bandpass": {"low": PARAM_SCALE_FLOAT, "high": PARAM_SCALE_FLOAT},
    "gauss_lowpass": {"cutoff": PARAM_SCALE_FLOAT},
    "gauss_highpass": {"cutoff": PARAM_SCALE_FLOAT},
    "notch": {
        "radius": PARAM_SCALE_INT,
        "offset_x": PARAM_SCALE_INT,
        "offset_y": PARAM_SCALE_INT,
    },
    "lower_threshold_limit": {"window": PARAM_SCALE_INT},
    "upper_threshold_limit": {"window": PARAM_SCALE_INT},
    "remove_small_components": {"min_size": PARAM_SCALE_AREA},
}
